<?php
require_once '../sub/init.php';
if (!ifint($uid))zeaialert('{"title":"用户不存在","btnt":"我知道了","url":"-1"}');
if(!is_mobile())header("Location: ".Href('u',$uid));
require_once ZEAI.'sub/conn.php';
require_once ZEAI.'cache/config_vip.php';
if($cook_jscode==$jscode && !empty($cook_jscode)){goto MAIN;}
$jumpurl = a('{"kind":"u","uid":"'.$uid.'"}');
/*是否登录*/
//if(!iflogin())json_exit(array('flag'=>'nologin','jumpurl'=>$jumpurl));
if(!iflogin()){
	if($js==1){
		json_exit(array('flag'=>'nologin','jumpurl'=>$jumpurl));
	}else{
		header("Location: ".HOST."/m/login.php"."?jumpurl=".urlencode($jumpurl));exit;
	}
}
//我的信息
$cook_uid=intval($cook_uid);
$row = $db->ROW(__TBL_USER__,"nickname,grade,loveb,birthday,heigh,pay,edu,RZ,myinfobfb,photo_s,photo_f,ifadm,sex,sign_pdf_flag","id=".$cook_uid);
$cook_loveb = $row['loveb'];
$cook_grade = $row['grade'];
$cook_RZ = $row['RZ'];$cook_RZarr = explode(',',$cook_RZ);
$cook_myinfobfb = intval($row['myinfobfb']);
$cook_photo_s  = $row['photo_s'];
$cook_photo_f   = intval($row['photo_f']);
$cook_ifadm     = intval($row['ifadm']);	
$cook_sex       = intval($row['sex']);
$cook_sign_pdf_flag  = $row['sign_pdf_flag'];
//检查拉黑
if (gzflag($cook_uid,$uid) == -1)json_exit(array('flag'=>0,'msg'=>'对方已经将你屏蔽，请求失败'));
//聊天/查看联系方式
if($submitok=='u_contact'){
	$chatContact_data = explode(',',$_VIP['chatContact_data']);
	if(count($chatContact_data)>0 && is_array($chatContact_data)){
		//前置条件
		if(empty($cook_photo_s))$cook_photo_f=0;
		$row0 = $db->ROW(__TBL_USER__,"sex","id=".$uid,"num");$sexx=$row0[0];
		$json=array("ARR"=>$chatContact_data,"jumpurl"=>$jumpurl,"RZarr"=>$cook_RZarr,"sex"=>$sexx,"cook_sex"=>$cook_sex,"cook_grade"=>$cook_grade,"cook_photo_f"=>$cook_photo_f,"cook_myinfobfb"=>$cook_myinfobfb,"data_bfb_num"=>intval($_VIP['chatContact_bfb_num']),"cook_sign_pdf_flag"=>$cook_sign_pdf_flag,"js"=>$js);
		Before_TJ(encode_json($json));
	}
	nocontact($cook_uid);
	nolevel($uid,$cook_uid,'contact',$chk_u_jumpurl);
	noucount_clickloveb($uid,$cook_uid,'contact');
	return_jscode($js);
}
MAIN:?>
<!doctype html><html><head><meta charset="utf-8">
<title><?php echo '详细资料-'.$_ZEAI['siteName'];?></title>
<?php echo HEADMETA; ?>
<link href="<?php echo RES;?>www_zeai_cn.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo RES;?>m/css/m.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo RES;?>m/css/u.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo HOST;?>/cache/zeaicolor.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<script src="<?php echo RES;?>www_zeai_cn.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/m.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<style>
#backtop a,.TRnav_btn i{color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.btmKefuBtn{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>;color:#fff}
body{background-color:#fff}
</style>
</head><body>
<?php
if ($submitok == 'u_data'){
	$mini_title='详细资料';$mini_class='top_mini4';
	require_once ZEAI.'m/top_mini.php';
	/*用户读库*/
	$fields = "dataflag,grade";
	$fields.=",".udata_arr('all','userF').',areatitle,area2title';//.get_mate_fld('list')
	$row = $db->ROW(__TBL_USER__,$fields,"(flag=1 OR flag=-2) AND id=".$uid);
	if ($row){
		$dataflag   = $row['dataflag'];
		$grade      = $row['grade'];
		$Urow       = $row;
	}else{
		zeaialert('{"title":"用户不存在","btnt":"我知道了","url":"-1"}');
	}
    $form_data=udata_arr('basic_ext');
	$form_data_num=intval(@count($form_data));$form_data_num_end=$form_data_num-3;
	if (!is_array($form_data))zeaialert('{"title":"暂无资料选项","btnt":"我知道了","url":"-1"}');
	require_once ZEAI.'cache/udata.php';
	function udata_title($data_data,$f,$kind='') {foreach($data_data as $v){if($v['fieldname'] == $f)if($kind=='subkind'){return $v['subkind'];}else{return $v['title'];}}}
	?>
    <div class="u_data">
    	<dl><dt>ID</dt><dd><?php echo $uid;?></dd></dl>
    	<dl><dt>用户等级</dt><dd><?php echo uicon($Urow['sex'].$grade,2); ?><span><?php echo utitle($grade); ?></span></dd></dl>
		<?php
		$n=1;
        foreach($form_data as $F){
			if($F['wwwflag']==0)continue;
            $F=$F['fieldname'];
			if($F=='parent' || $F=='photo_s' || $F=='aboutus')continue;
            $subkind = udata_title($form_data,$F,'subkind');
            $T = udata_title($form_data,$F);
			//
			if($Urow['sex']==2 && $F=='tag1')continue;
			if($Urow['sex']==1 && $F=='tag2')continue;
			if($F=='tag1' || $F=='tag2'){
				$DATA = $Urow['tag'];
			}else{
				$DATA = $Urow[$F];
			}
			//
            $DATA_str = '';
            //控件类型
            switch ($subkind) {//1:文本,2:单选,3:复选,4:区间,5:特殊
                case 1:$DATA = trimhtml(dataIO($DATA,'wx'),'keep_rn');$DATA_str = $DATA;break;
                case 2:$DATA_str = udata($F,$DATA);break;
                case 3:$DATA_str = udata($F,$DATA);break;
                case 4:$DATA_str = udata($F,$DATA);break;
            }
            //控件类型-特殊
            switch ($F) {
                case 'birthday':
                    $DATA_str = $DATA;
                break;
                case 'areaid':
                    $DATA_str=(!empty($Urow['areatitle']))?$Urow['areatitle']:$DATA_str;
                break;
                case 'area2id':
                    $DATA_str=(!empty($Urow['area2title']))?$Urow['area2title']:$DATA_str;
                break;
                case 'aboutus':$class='txtarea';break;
            }
    
            $dl0=($n % 6==0 || $form_data_num_end==$n)?' dl0':'';
            if(!empty($DATA_str))echo '<dl class="'.$dl0.'"><dt>'.$T.'</dt><dd>'.$DATA_str.'</dd></dl>';
            $n++;
        }?>
    </div>
	<div class="bottomblank"></div>
<?php require_once ZEAI.'m/TRnav.php';}elseif($submitok == 'u_contact'){
	$row = $db->NAME($uid,"mob,weixin,weixin_pic,qq,email,mob_ifshow,qq_ifshow,weixin_pic_ifshow,weixin_ifshow,email_ifshow");
	if ($row){
		$weixin     = dataIO($row['weixin'],'out');
		$weixin_pic = dataIO($row['weixin_pic'],'out');
		$qq         = dataIO($row['qq'],'out');
		$email      = dataIO($row['email'],'out');
		$mob        = dataIO($row['mob'],'out');
		//
		$mob_ifshow        = $row['mob_ifshow'];
		$qq_ifshow         = $row['qq_ifshow'];
		$weixin_pic_ifshow = $row['weixin_pic_ifshow'];
		$weixin_ifshow     = $row['weixin_ifshow'];
		$email_ifshow	   = $row['email_ifshow'];	
		$weixin_str     =($weixin_ifshow==1)?$weixin:' 已设置保密';
		$weixin_pic_str =($weixin_pic_ifshow==1)?$weixin_pic:' 已设置保密';
		$mob_str        =($mob_ifshow==1)?$mob:' 已设置保密';
		$qq_str         =($qq_ifshow==1)?$qq:' 已设置保密';
		$email_str      =($email_ifshow==1)?$email:' 已设置保密';
		//
		$weixin_str =(!empty($weixin_str))?$weixin_str:' -未填-';
		$weixin_pic_str =(!empty($weixin_pic_str))?$weixin_pic_str:' -未上传-';
		$qq_str     =(!empty($qq_str))?$qq_str:' -未填-';
		$email_str  =(!empty($email_str))?$email_str:' -未填-';
		$mob_str    =(!empty($mob_str))?$mob_str:' -未填-';

	}else{zeaialert('{"title":"用户不存在","btnt":"我知道了","url":"-1"}');}?>
	<?php	
	$mini_title='联系方式';
	require_once ZEAI.'m/top_mini.php';?>
    <div class="u_contact">
        <ul>
            <li><h4><i class='ico weixin'>&#xe607;</i>微信</h4><span><?php echo $weixin_str;?></span></li>
            <li><h4><i class='ico weixin'>&#xe62e;</i>微信二维码</h4><span>
            <div class="wxpic" id="wxpic">
            <?php if (!empty($weixin_pic) && $weixin_pic_ifshow==1){?>
                点击放大 <font class="ico">&#xe62d;</font>　
                <img src="<?php echo UP.$weixin_pic;?>" onClick="ZeaiM.piczoom('<?php echo UP.$weixin_pic;?>');">
             <?php }else{echo $weixin_pic_str;}?>
            </div>                
            </span></li>
            <li><h4><i class='ico qq'>&#xe623;</i>QQ</h4><span><?php echo $qq_str; ?></span></li>
            <li><h4><i class='ico email'>&#xe641;</i>邮箱</h4><span><?php echo $email_str;?></span></li>
            <?php if ($mob_ifshow==1 && ifmob($mob)){?><li><h4><i class='ico mob'>&#xe627;</i> 手机</h4><span><a href="tel:<?php echo $mob;?>" class="C666"><font class="ico S18 C666" style="display:inline-block">&#xe7c1;</font><?php echo $mob;?></a></span></li><?php }?>
        </ul>
    </div>
<?php }?>
<div id="backtop"><a href="#top" id="btmTopBtn"><i class="ico">&#xe60c;</i>顶部</a></div>
<script>document.body.onscroll = backtop_alone;</script>
</body></html>